package com.sy.controller;

import com.sy.dto.JsonResult;
import com.sy.sevice.TeacherService;
import com.sy.vo.ModifyTeacherVo;
import com.sy.vo.InputFormVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Yasuda-T JianBo-Sheng
 * @version 1.0
 * @date 2020/9/14 13:58
 * @usage 老师类相关的控制器
 */
@RestController
@RequestMapping("teachers")
public class TeacherController {
    @Autowired
    private TeacherService teacherService;

    @RequestMapping(value = "",method = RequestMethod.POST)
    public JsonResult addTeacher(@RequestBody InputFormVo addUserVo){
        System.out.println(addUserVo);
        return teacherService.addTeacher(addUserVo);
    }

    /**
     * @author JianBo-Sheng
     * @version 1.0
     * @date 2020/9/14 17:14
     * 修改老师个人信息
     * @param modifyTeacherVo 老师信息携带对象
     * @return 修改成功的老师信息
     */
    @RequestMapping(value = "",method = RequestMethod.PUT)
    public JsonResult updateTeacher(@RequestBody ModifyTeacherVo modifyTeacherVo){
        System.out.println(modifyTeacherVo);
        return teacherService.modifyTeacher(modifyTeacherVo);
    }
}
